$(document).ready(function(){
	moreFactoryInspection();
})


function moreFactoryInspection()
{
	var refClientId = $('#ref-client-id').val();
	var curPage = $('#currentPage').val();
	
	
	$.post(basePath+'/factoryinspection/getFactoryInspectionList.do',{
		
		refClientId:refClientId,currentPage:curPage
		
	},function(data){
		
				
		if(data.status==10001)
		{
			
			if (data.dataNum == 0) {
				
				$('#moreFactoryInspection').hide();		
				
				return;
			}
			
			$('#currentPage').val(parseInt(curPage) + 1);
			
			
			var u = $('#order-ul');

			var arr = data.data;

			for (var i = 0; i < arr.length; i++) {

				var newchild = document.createElement("li");

				newchild.className = 'mui--divider-bottom';

				var uDate = new Date();
				uDate.setTime(arr[i].updatedAt);
				
				var cDate = new Date();
				cDate.setTime(arr[i].createdAt);
				
				var status=arr[i].orderStatus;
				
				if(status==0)
					{
					status='<span style="color:red">进行中</span>';
					}
			
				else
					{
					status="已关闭";
					}
				
				var li = '<a href="' + basePath + '/factoryinspection/edit.do?id='
						+ arr[i].id + '&refClientId='+arr[i].refClientId+'">' 
						+ '<h4>订单号：' +  arr[i].orderNo	+ '，状态：'+status+'</h4>' 
						+ '<h5>工厂：' + arr[i].factoryName + '</h5>'
						+ '<h5>工厂负责人：' + arr[i].factoryManagerName + '，联系方式：'+arr[i].factoryManagerContact+'</h5>'
						//+ '<h5>工厂负责人联系方式：' + arr[i].factoryManagerContact + '</h5>'
						//+ '<h5>录入人：' + arr[i].createdBy + '，手机：'+arr[i].createdByMobile+'</h5>'
						+ '<h6>创建时间：' + cDate.toLocaleString() + '('+arr[i].createdBy+'/'+arr[i].createdByMobile+')</h6>'
						+ '<h6>更新时间：' + uDate.toLocaleString() + '</h6></a>'
						
						newchild.innerHTML = li;
						
						u.append(newchild);

				;
			}
			
			
		}
		
	})

}